package TimeToWork.Android;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public final class WeekFragment extends Fragment {
   
    private static final String TAG = "WeekFragment";
    private TextView foo;

    public static WeekFragment newInstance(String dcWeek) {
        Log.d(TAG, "Instansiate: " + dcWeek);
        WeekFragment pageFragment = new WeekFragment();
        Bundle bundle = new Bundle();
        //bundle.putParcelable("DCWeek", dcWeek);
        bundle.putString("DCWeek", dcWeek);
        pageFragment.setArguments(bundle);
        return pageFragment;
    }
    
    @Override  
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override  
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        Log.v(TAG, "Created new fragment.");
        View view = inflater.inflate(R.layout.fragment, container, false);
        foo = (TextView) view.findViewById(R.id.textView1);
        //foo.setText(((DCWeek)getArguments().getParcelable("DCWeek")).getStrWeek());
        foo.setText(getArguments().getString("DCWeek"));
        return view;
    }
    
    public String getText() {
        VDWeek foo = getArguments().getParcelable("VDWeek");
        return foo.week;

    }
    
    public CharSequence getDCWeek() {
        return foo.getText();
    }
    
    public void setDCWeek(String dcWeek) {
        foo.setText(dcWeek);
    }
    
    static class ViewHolder {
        TextView week;
    }

    public void setDCWeek(CharSequence dcWeek) {
        
        TextView bar = (TextView)this.getView().findViewById(R.id.textView1);
        bar.setText((String)dcWeek);
        //foo.setText(dcWeek);
    }
}
